<?php
/**
 * 控制器抽象类
 *
 */
abstract class Controller
{
	/**
	 * 模板类
	 *
	 * @var obj;
	 */
	var $tpl;
	var $in_var;
	var $lang;
	var $sys_conf_var;
	
	
	/**
	 * 构造函数
	 *
	 */
	function __construct()
	{
		
		global $tpl,$in_var,$admin_lang,$sys_info,$sys_conf_var;
		
		$this->tpl            = $tpl;
		$this->in_var         = $in_var;
		$this->lang           = $admin_lang;
		$this->sys_info       = $sys_info;
		$this->sys_conf_var   = $sys_conf_var;
	}
	
	/**
	 * 加载模型
	 *
	 * @param string $class
	 */
	function loadModel($class)
	{
		$numargs = func_num_args();
		
		if($numargs == 1)
		{
			$this->$class = new $class();
		}
		else 
		{
			$arg_list = func_get_args();
			
		    for ($i = 0; $i < $numargs; $i++) {
		    	if($i > 0)
		    	{
		    		$args[] = '$arg_list[' . $i . ']';
		    	}
		    }
		    
		    eval('$this->$class = new $class(' . implode(',',$args) . ');');
		}
	}
	
	/**
	 * 加载类库文件
	 *
	 * @param string $class
	 */
	function loadClass($class)
	{
		$numargs = func_num_args();
		
		if($numargs == 1)
		{
			$this->$class = new $class();
		}
		else 
		{
			$arg_list = func_get_args();
			
		    for ($i = 0; $i < $numargs; $i++) {
		    	if($i > 0)
		    	{
		    		$args[] = '$arg_list[' . $i . ']';
		    	}
		    }
		    
		    eval('$this->$class = new $class(' . implode(',',$args) . ');');
		}
	}
	
	/**
	 * destruct function
	 *
	 */
	function __destruct()
	{
		//debug();
	}
}


?>